#include "Corvette.h"

Corvette :: Corvette(const string& _name, const Point<int>& _origin, const CorvetteConfiguration* config, char _filledChar = 'c')
:  Boat(_name, _origin), firedPoints(0) {
	body = config->getShape(_name, _origin, _filledChar);
}

Corvette :: ~Corvette() {
	delete body;
}

bool Corvette :: fireToBoat(const Point<int>& pt, Arena* ar) {
	if (body->fireToBoat(pt, ar)) {
		if (isDestroyed()) {
			body->writeDestroyed(ar);
		}
		return true;
	} else {
		ar->setWaterPoint(pt);
		return false;
	}
}

void Corvette :: write(Arena* ar) throw (OutOfBound, OverlapBoat, TooNearBoat) {
	body->write(ar);
}

bool Corvette :: isDestroyed() {
	return body->isDestroyed();
}
